package com.feicheng.iou.controller.common;

import com.feicheng.iou.commom.ReturnCode;
import com.feicheng.iou.entity.ReservationBackview;
import com.feicheng.iou.exception.SystemException;
import com.feicheng.iou.result.ResultInfo;
import com.feicheng.iou.service.ReservationBackviewService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wuweinan
 * @since 2021-06-28
 */
@RestController
@RequestMapping("/iou/common")
@Slf4j
public class ReservationBackviewCommonController {

    @Autowired
    private ReservationBackviewService reservationBackviewService; //预约回访实现类

    /**
     * @param reservationBackview
     * @return ResultInfo
     * @Author wuweinan
     * @Description 更改预约回访信息接口
     * @Date 2021-6-29 17:19
     */
    @PutMapping("/backview")
    public ResultInfo addBackviewTime(ReservationBackview reservationBackview) {

        log.info("ReservationBackviewCommonController的addBackviewTime方法进入");

        //参数是否为空校验
        if (reservationBackview == null) {
            throw new SystemException(ReturnCode.PARAM_NOT_NULL);
        }

        //插入一条预约回访信息
        log.info("ReservationBackviewCommonController的addBackviewTime返回");

        //全部变为更新 , 在添加线索 和 转到访 和 转
        return reservationBackviewService.updateBackviewReservationTime(reservationBackview);

    }
}
